﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TFXK.BLL;
using TFXK.Common;
using log4net;
using TFXK.Model;
using System.Data;
public partial class HY_CaseInfo : System.Web.UI.Page
{
    private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
    private static readonly CategoryBLL bllCategory = new CategoryBLL();
    private static readonly NewsBLL bllNews = new NewsBLL();
    private static readonly HotelBLL bllHotel = new HotelBLL();
    public News modelTemp = new News();
    private static readonly PicturesBLL bllPictures = new PicturesBLL();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            try
            {
                if (!IsPostBack)
                {
                    if (string.IsNullOrEmpty(Request.QueryString["Key"] + ""))
                    {
                        Response.Redirect("HotelList.aspx");
                    }
                    else
                    {
                        int Key = int.Parse(Request.QueryString["Key"] + "");
                        InitData(Key);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
                Response.Redirect("HY_Default.aspx",false);
            }
        }
    }
    public void InitData(int Key)
    {
        modelTemp = bllNews.GetModel(Key);
        this.Title += "-" + modelTemp.title;
       Pictures model= bllPictures.GetModel(modelTemp.id, modelTemp.parentId);
       if (model != null)
       {
           imgPic.ImageUrl = "uploads/" + model.imgPath;
           imgPic.Visible = true;
       }
       else {
           imgPic.Visible = false;
       }
    }

}
